import AsyncStorage from '@react-native-async-storage/async-storage';

export class AsyncStorageKey{
    static readonly USER_TOKEN="user_token"
}

export const setUserTokenData = async (value: string) => {
  try {
    await AsyncStorage.setItem(AsyncStorageKey.USER_TOKEN, value);
  } catch (e) {
  }
};

export const getUserTokenData = async () => {
  try {
    const value = await AsyncStorage.getItem(AsyncStorageKey.USER_TOKEN);
    if (value !== null) {
      return value;
    }
  } catch (e) {
  }
};

// 删除数据
export const removeData = async (key: string) => {
  try {
    await AsyncStorage.removeItem(key);
  } catch (e) {
  }
};
